package com.woniuxy.main.dynamic_lzq.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.woniuxy.main.dynamic_lzq.mapper.CoachMapper_Lzq;
import com.woniuxy.main.dynamic_lzq.pojo.Coach;
import com.woniuxy.main.dynamic_lzq.pojo.Course;
import com.woniuxy.main.dynamic_lzq.pojo.User;
import com.woniuxy.main.dynamic_lzq.service.CoachService_Lzq;

import lombok.Data;

@Service
@Data
public class CoachServiceImpl_Lzq implements CoachService_Lzq{
	@Autowired
	private CoachMapper_Lzq coachMapper;
	
	@Override
	public List<Coach> showCoach() {
		
		return coachMapper.showCoach();
	}

	@Override
	public List<Coach> findCoachesByUsers(List<User> users) {
		List<Coach> coachs = new ArrayList<Coach>();
		for(int i = 0;i<users.size();i++){
			User user = users.get(i);
			Coach coach = coachMapper.findCoachByUid(user.getUser_id());
			coachs.add(coach);
		}
		return coachs;
	}

	@Override
	public List<Coach> listCoachesByPrice() {
		
		return coachMapper.listCoachesByPrice();
	}

	@Override
	public Coach findCoachByUid(int user_id) {
		
		return coachMapper.findCoachByUid(user_id);
	}

	@Override
	public List<Course> findCoursesByCid(int coach_id) {
		
		return coachMapper.findCoursesByCid(coach_id);
	}
}
